<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box">
        <input type="text" id="text">
    </div>
    
    <script>
        const box = document.getElementById('box');
        const textInput = document.getElementById('text')
        // 第三个参数true表示该元素在事件的“捕获阶段”(由外往内传递时)响应事件; 
        // false表示该元素在事件的“冒泡阶段”(由内向外传递时)响应时间。默认
        box.addEventListener('click',function() {
            console.log('box onclick')
        },true)
        text.addEventListener('click',function() {
            console.log('text onclick')
        },true)
        // text.onClick = function(e) {  // dom 0级事件
        //     console.log('onclick')
        // }
        text.onFocus = function(e) {
            console.log('onFocus')
        }
        text.onmousedown = function(e) {
            console.log('onmousedown')
        }
        text.onmouseenter = function(e) {
            console.log('onmouseenter')
        }
    </script>
</body>
</html>